package com.drg.center.controller;


import com.drg.center.entity.param.DiagnosisGroupPageDTO;
import com.drg.center.entity.param.GroupPredictionDTO;
import com.drg.center.entity.result.*;
import com.drg.center.service.DrgPredictionService;
import com.guaike.core.entity.result.PageEntity;
import com.guaike.core.entity.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;


@Slf4j
@RestController
@RequestMapping("/prediction")
@Api(tags = "DRG分组预测接口组")
@AllArgsConstructor
public class DrgPredictionController {

    private final DrgPredictionService drgPredictionService;

    @GetMapping("/diagnosisGroupPage")
    @ApiOperation(value = "诊断分组查询列表")
    public Result<PageEntity<DiagnosisGroupVO>> diagnosisGroupPage(@Valid DiagnosisGroupPageDTO param) {
        return drgPredictionService.diagnosisGroupPage(param);
    }

    @GetMapping("/searchMDC")
    @ApiOperation(value = "搜索MDC")
    public Result<List<MdcVO>> searchMDC(@ApiParam("搜索字段，编码/名称") @RequestParam("search") String search) {
        return drgPredictionService.searchMDC(search);
    }

    @GetMapping("/searchADRG")
    @ApiOperation(value = "搜索ADRG")
    public Result<List<AdrgVO>> searchADRG(@ApiParam("搜索字段，编码/名称") @RequestParam("search") String search) {
        return drgPredictionService.searchADRG(search);
    }

    @GetMapping("/searchDiagnosis")
    @ApiOperation(value = "搜索诊断")
    public Result<List<DiagnosisVO>> searchDiagnosis(@ApiParam("搜索字段，编码/名称") @RequestParam("search") String search) {
        return drgPredictionService.searchDiagnosis(search);
    }

    @GetMapping("/searchOperation")
    @ApiOperation(value = "搜索手术")
    public Result<List<OperationVO>> searchOperation(@ApiParam("搜索字段，编码/名称") @RequestParam("search") String search) {
        return drgPredictionService.searchOperation(search);
    }

    @PostMapping("/groupPrediction")
    @ApiOperation(value = "CHS入组预测")
    public Result<GroupPredictionVO> groupPrediction(@Valid @RequestBody GroupPredictionDTO param) {
        return drgPredictionService.groupPrediction(param);
    }


}
